<?php

require_once __DIR__ . '/DoctrineObjectModel.php';
require_once __DIR__ . '/DoctrineORM.php';
require_once __DIR__ . '/DoctrineODM.php';

class DoctrineManager {
	
	protected $vendor;

	public static function RegisterNamespace($namespace, $path) {
		$path = $path === null ? __DIR__ : rtrim($path, ' /');
		if (!class_exists('Doctrine\Common\ClassLoader')) throw new Exception('Doctrine\Common\ClassLoader not found');

		$loader = new Doctrine\Common\ClassLoader($namespace, $path);
		$loader->register();
	}

	public static function GetObjectModel($objectModel, $options = array()) {
		switch ($objectModel) {
			case 'ORM':
				return new DoctrineORM($options);
			case 'ODM':
				return new DoctrineODM($options);
			default:
				throw new Exception('Unknown object model');
		}
	}
}
